# -*- coding: utf-8 -*-
# @Time    : 2021/4/19 10:01
# @Author  : N
# @Email   : 
# @File    : ATM取款.py
# @Software: PyCharm
def takemoney(y):
    b=int(input("请输出你要取的钱："))
    if b>y:
        print("余额不足")
    else:
        y=y-b
        print("取款成功，你的余额为：",y)
        return  y
def givemoney(y):
    c=int(input("请输入你要存的钱："))
    y=y+c
    print("存款成功，你的余额为",y)
    return y
def findmoney():
    print("你的余额为：",y)
while True:
    username = input("请输入你的账户：")
    userpassword = int(input("请输入你的密码："))
    if username == "root" and userpassword == 123456:
        print("登录成功")

        while True:
            y = 10000
            print("请选择需要的编号：".center(50, "="))
            print("1.取钱")
            print("2.存钱")
            print("3.查询余额")
            num = int(input("请选择编号："))
            if num == 1:
                takemoney(y)
            if num == 2:
                givemoney(y)
            if num == 3:
                findmoney()
    else:
        print("账户或密码错误")



